namespace game {
    export namespace gameConfig {
        export class CSV {
            //"name,value\r\nmonsterEnterTime,\"400,500\"\r\ntipStartTime,300\r\ntipEndTime,500\r\ntipGapTime,500\r\noperateSrartTime,500\r\noperateEndTime,500\r\nmonsterExitTime,500\r\nlevelGapTime,500\r\ngameOverLevel,5\r\nperfectTime,100\r\ngoodTime,200\r\nmissTime,300\r\ntipHandTime,200\r\ntipEffectTime,200\r\nfaceChangeTime,500\r\n"
            public static Parse(content: string): Array<Array<string>> {
                let list: Array<Array<string>> = new Array<Array<string>>();
                content = lib.StringDo.replaceString(content, '\r', '\n');
                content = lib.StringDo.replaceString(content, "\n\n", '\n');
                let array: Array<string> = content.split('\n');
                for (let i = 0, len = array.length; i < len; i++) {
                    let start = 0;
                    let end = start;
                    let special = false;
                    let rowStr = array[i];
                    if (rowStr.length == 0) continue;
                    let row = new Array<string>();
                    list.push(row);
                    for (let c = 0, clen = array[i].length; c < clen; c++) {
                        if (rowStr[c] == '"') {
                            if (special == false) {
                                special = true;
                                start = c + 1;
                                end = start;
                            }
                            else {
                                if (c + 1 < clen && rowStr[c + 1] == '"') {
                                    c++;
                                    end++;
                                }
                                else {
                                    if (c == clen - 1) {
                                        row.push(rowStr.slice(start, end));
                                    }
                                    special = false;
                                }
                            }
                        }
                        else if (rowStr[c] == ',') {
                            if (!special) {
                                row.push(rowStr.slice(start, end));
                                start = c + 1;
                                end = start;
                            }
                            else {
                                end++;
                            }
                        }
                        else {
                            end++;
                            if (c == clen - 1) {
                                row.push(rowStr.slice(start, end));
                            }
                        }
                    }
                }
                return list;
            }
        }
    }
}